package Code;

/**
 * @author zihao
 * @date 2025/3/18 19:32
 * @VERSION
 * @description
 **/
public class Vehicle {
    public int speed;
    public double size;

    //行为
    public void move() {
        System.out.println("小车正在加速");
    }

    public void speedUp(){
        System.out.println("小车加速到200km/h");
    }
    public void speedDown(){
        System.out.println("小车减速到90km/h");
    }
    //构造方法
    //无参构造
    public Vehicle() {
    }
    //满参构造
    public Vehicle(int speed, double size) {
        this.speed = speed;
        this.size = size;
    }
    //getter and setter
    public int getSpeed() {
        return speed;
    }

    public double getSize() {
        return size;
    }

    public void setSize(double size) {
        this.size = size;
    }
    public void setSpeed(int speed){
        this.speed=speed;
    }

    public static void main(String[] args) {
        Vehicle vehicle=new Vehicle();
        vehicle.setSpeed(102);
        System.out.println("vehicle.getSpeed() = " + vehicle.getSpeed());
        vehicle.move();
        vehicle.speedUp();
        vehicle.speedDown();
    }
}
